package com.yzkj.cpjxc.business.controller;

import com.yzkj.cpjxc.business.framework.utils.JsonUtils;
import com.yzkj.cpjxc.business.system.exception.Message;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 公共页面Controller
 */
@Controller
@RequestMapping("/common")
public class CommonController extends BaseController {
	
	/**
	 * 错误公共页面
	 */
	@RequestMapping("/commonErrorMessage")
	public ModelAndView commonErrorMessage(HttpServletRequest request) throws Exception {
		Message mess = (Message) request.getSession().getAttribute("mess");
		return new ModelAndView("common/message").addObject("mess", mess);
	}
	
	/**
	 * 信息提示页面
	 */
	@RequestMapping("/commonMess")
	public ModelAndView commonMess(HttpServletRequest request, Message mess) throws Exception {
		return new ModelAndView("common/message").addObject("mess", mess);
	}
	
	/**
	 * 安全检查不通过信息页面
	 */
	@RequestMapping("/notThroughSecurityCheck")
	public ModelAndView notThroughSecurityCheck(HttpServletRequest request, HttpServletResponse response, Message mess) throws Exception {
		String securityCheckMess = mess.getTitle() + "：" + mess.getContent();
		JsonUtils.responseJson(response, securityCheckMess);
		return null;

	}
}

